clc
clear all
motor_on_data = xlsread('Board Only Data.xls','z constant');
for i = 1:length(motor_on_data(:,1));
    rho(i,1) = ((motor_on_data(i,1)^2)+(motor_on_data(i,2)^2))^(1/2);
    theta(i,1) = (atan((motor_on_data(i,2))/(motor_on_data(i,1))));
    if motor_on_data(i,1) >= 0 & motor_on_data(i,2) >= 0
        theta(i,1) = theta(i,1);
    end
    if motor_on_data(i,1) < 0 & motor_on_data(i,2) >= 0
        theta(i,1) = pi + theta(i,1);
    end
    if motor_on_data(i,1) < 0 & motor_on_data(i,2) < 0
        theta(i,1) = pi + theta(i,1);
    end
    if motor_on_data(i,1) >= 0 & motor_on_data(i,2) < 0
        theta(i,1) = 2*pi + theta(i,1);
    end
end

figure
polar(theta(:,1),rho(:,1),'.');
title('Board Only Constant Z')

motor_on_data = xlsread('Board Only Data.xls','x constant');
for i = 1:length(motor_on_data(:,1));
    rho(i,1) = ((motor_on_data(i,3)^2)+(motor_on_data(i,2)^2))^(1/2);
    theta(i,1) = (atan((motor_on_data(i,2))/(motor_on_data(i,3))));
    if motor_on_data(i,3) >= 0 & motor_on_data(i,2) >= 0
        theta(i,1) = theta(i,1);
    end
    if motor_on_data(i,3) < 0 & motor_on_data(i,2) >= 0
        theta(i,1) = pi + theta(i,1);
    end
    if motor_on_data(i,3) < 0 & motor_on_data(i,2) < 0
        theta(i,1) = pi + theta(i,1);
    end
    if motor_on_data(i,3) >= 0 & motor_on_data(i,2) < 0
        theta(i,1) = 2*pi + theta(i,1);
    end
end

figure
polar(theta(:,1),rho(:,1),'.');
title('Board Only Constant X')

motor_on_data = xlsread('Board Only Data.xls','y constant');
for i = 1:length(motor_on_data(:,1));
    rho(i,1) = ((motor_on_data(i,1)^2)+(motor_on_data(i,3)^2))^(1/2);
    theta(i,1) = (atan((motor_on_data(i,3))/(motor_on_data(i,1))));
    if motor_on_data(i,1) >= 0 & motor_on_data(i,3) >= 0
        theta(i,1) = theta(i,1);
    end
    if motor_on_data(i,1) < 0 & motor_on_data(i,3) >= 0
        theta(i,1) = pi + theta(i,1);
    end
    if motor_on_data(i,1) < 0 & motor_on_data(i,3) < 0
        theta(i,1) = pi + theta(i,1);
    end
    if motor_on_data(i,1) >= 0 & motor_on_data(i,3) < 0
        theta(i,1) = 2*pi + theta(i,1);
    end
end

figure
polar(theta(:,1),rho(:,1),'.');
title('Board Only Constant Y')